package com.gw.jpa.controller;

import com.gw.jpa.entity.Emp;
import com.gw.jpa.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/emp")
public class EmpController {
    @Autowired
    EmpService empService;
    @GetMapping("")
    public List<Emp> getEmpJquery(){
        //调用service层，获取所有员工信息
        return empService.getEmpJquery();
    }
    @GetMapping("{empno}")
    public Emp getEmp(@PathVariable("empno") Integer empno){
        //调用service层，获取指定empno的员工信息
        return empService.getEmp(empno);
    }
}
